package org.kotboot.domain;

import com.alibaba.fastjson.annotation.JSONField;
import org.kotboot.domainext.ExtAll;
import org.kotboot.enums.ECommodityState;
import org.kotboot.enums.PostageModel;
import org.kotboot.kit.K;

import javax.persistence.Table;

/**
 * jisong.sun 2017/9/19 17:15
 */
@Table(name = "ms_commodity")
public class Commodity extends ExtAll {
    private String title;
    private String summary;
    private Long store_id;
    private String main_photo;
    @JSONField(serialize = false)
    private ECommodityState state;
    private Long class_id;
    private Long brand_id;
    private String from_city;
    @JSONField(serialize = false)
    private PostageModel postage_model;

    public String getStatus() {
        return K.toStr(state);
    }
    public void setStatus(String val){
        this.state = ECommodityState.of(val);
    }

    public String getPostage(){
        return K.toStr(postage_model);
    }

    public void setPostage(String code){
        this.postage_model = PostageModel.of(code);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public Long getStore_id() {
        return store_id;
    }

    public void setStore_id(Long store_id) {
        this.store_id = store_id;
    }

    public String getMain_photo() {
        return main_photo;
    }

    public void setMain_photo(String main_photo) {
        this.main_photo = main_photo;
    }

    public ECommodityState getState() {
        return state;
    }

    public void setState(ECommodityState state) {
        this.state = state;
    }

    public Long getClass_id() {
        return class_id;
    }

    public void setClass_id(Long class_id) {
        this.class_id = class_id;
    }

    public Long getBrand_id() {
        return brand_id;
    }

    public void setBrand_id(Long brand_id) {
        this.brand_id = brand_id;
    }

    public String getFrom_city() {
        return from_city;
    }

    public void setFrom_city(String from_city) {
        this.from_city = from_city;
    }

    public PostageModel getPostage_model() {
        return postage_model;
    }

    public void setPostage_model(PostageModel postage_model) {
        this.postage_model = postage_model;
    }

    @Override
    public String toString() {
        return K.toJson(this);
    }
}
